UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aY4zLMUwWjTuUta5t/Ju4HPpCgY+jvXX30yCueQIo10='
WHERE
key_id = '58b93ae9f39d305efaf83e0da30506709c11ea8fe2f89d6eb48334851cc5ab53'
AND (
token = 'aY4zLMUwWjTuUta5t/Ju4HPpCgY+jvXX30yCueQIo10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)