UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eeWSsHk3dTj2LjHGIYyJdgXYBSzWOF4Gu9Y5rf5H6+o=' 
WHERE 
  key_id = '0c0b7224d1fa78e1b96694d12f230327b9cbda2fc8f3741169f5462823add587' 
  AND (
    token = 'eeWSsHk3dTj2LjHGIYyJdgXYBSzWOF4Gu9Y5rf5H6+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030