UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3wre1unwR8wHEdhe6IPUQCyey4NZTeX5x7qcSwrNIuw='
WHERE
key_id = '56d390483a33d41817f4c4d9b47f283003502fab391f902fa0a98f4f1eedc50f'
AND (
token = '3wre1unwR8wHEdhe6IPUQCyey4NZTeX5x7qcSwrNIuw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)