UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CbcnneVRorWi4M0k2JYE12sYcrFhdAUahjH/xveKj9M=' 
WHERE 
  key_id = 'edcfb4f521d69140394dfc28a79dd8f2700778edabda3dc68174324bab29936b' 
  AND (
    token = 'CbcnneVRorWi4M0k2JYE12sYcrFhdAUahjH/xveKj9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041