UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'apRRJ32aCi+bbOjKlNVKjKudd+63yh3GpTTyIxlo+qo='
WHERE
key_id = '243aeace8fd0da2b1ee55442ec021c712d01dd0d236afb6186d411832926d911'
AND (
token = 'apRRJ32aCi+bbOjKlNVKjKudd+63yh3GpTTyIxlo+qo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)