UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KlklimTx91UU152axSpxAmnrbPH50RFH8DJvODAf8jY=' 
WHERE 
  key_id = '7df9b420544ec02e1e92ed69aa9fae0cfcf08c1cf315eb0c9b01c04e2a407474' 
  AND (
    token = 'KlklimTx91UU152axSpxAmnrbPH50RFH8DJvODAf8jY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057