UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p5Pb4y2+FdqBn4w+GqxKThtLgm4mWr3NAtf2bG7GvlE=' 
WHERE 
  key_id = 'ea406c99defc74c243b3d7920998b740c54f3db37421817cad538a1a73a278ea' 
  AND (
    token = 'p5Pb4y2+FdqBn4w+GqxKThtLgm4mWr3NAtf2bG7GvlE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038