UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bHTqMSUgb9r+OOghM+61cJpgAhLV4Fy4aeRl9fBIu40='
WHERE
key_id = 'd41ac5733218fb077537fbbebf323e8cfc1f90043610b1cdae3a263de67fbd12'
AND (
token = 'bHTqMSUgb9r+OOghM+61cJpgAhLV4Fy4aeRl9fBIu40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)