UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oj2TST8hzM4i5lyaZHHRuxfDAP4i/NDZE8HL8DHJYDA=' 
WHERE 
  key_id = 'ff5059761e1c8f069c070759d8050ff070be212cf7e2729a5d873c1b152e2f09' 
  AND (
    token = 'oj2TST8hzM4i5lyaZHHRuxfDAP4i/NDZE8HL8DHJYDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036