UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fKhJu5VrqmdQoGMKrl3GiSTMJI4VOHSn9ZlMdzJVSYY=' 
WHERE 
  key_id = 'd2b2a13dec1defbcb828661fbe6e344e596d8638cda758a11d164681ef99f111' 
  AND (
    token = 'fKhJu5VrqmdQoGMKrl3GiSTMJI4VOHSn9ZlMdzJVSYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028