UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PyljfivQn5m2NnP8LLAo+jFuPoxTGYEyICPsoFCY8Gg='
WHERE
key_id = 'cefa9050aae602fe76a034734a3927f86fbc69fd0500fbef92a01bd9e7609d73'
AND (
token = 'PyljfivQn5m2NnP8LLAo+jFuPoxTGYEyICPsoFCY8Gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)