UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hfqMn0x4aHHaWTcItsksRmySmrY8F7XnDigm04Dhugk=' 
WHERE 
  key_id = '03853cddae80688cab4358e76ab4eb1a4fd9f1af0c0bf1a11fffa327b26c5588' 
  AND (
    token = 'hfqMn0x4aHHaWTcItsksRmySmrY8F7XnDigm04Dhugk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054