UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZfRlhdHWjryXe5woFswxLz2avkIGMubtvfCV3qMHNbc=' 
WHERE 
  key_id = '838b67860c7d1416d1c346e0989f3ed60f63dc58a7a9195185e6b950f048975e' 
  AND (
    token = 'ZfRlhdHWjryXe5woFswxLz2avkIGMubtvfCV3qMHNbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038