UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm8Nsl13F1ePaYeH7R5grIqUFpa3Le3WM9KX2dWLH4QI=' 
WHERE 
  key_id = '580db332e47649452ed2d9ca2731a50ac7f0e96436703db2fec202517e3c1c0c' 
  AND (
    token = 'm8Nsl13F1ePaYeH7R5grIqUFpa3Le3WM9KX2dWLH4QI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053