UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S4jnmOTrDVUq7yGCE0VxKYXDd9TIkq+poiG5H0z4ruo='
WHERE
key_id = 'a6df4475fcd84d32ac2d4fe7bdd081e0fc1a8e608fde17e8debe0b60fdf5312d'
AND (
token = 'S4jnmOTrDVUq7yGCE0VxKYXDd9TIkq+poiG5H0z4ruo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)