UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'azf/hYxZAdf3JgaGOdJ+OhwrCuMN94ynyA35+9Y3Vf4='
WHERE
key_id = '94ad7f446a9817035a4409dbd97ec0b6bcdddd51b1f797da7abcf39a895aa881'
AND (
token = 'azf/hYxZAdf3JgaGOdJ+OhwrCuMN94ynyA35+9Y3Vf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)