UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LaGIfDbxRDuxInEJlo59Cxs0xwk2a4CjUdk5aeMk9QI=' 
WHERE 
  key_id = 'fd0317e82c6a4b2e86aae2161b982c62ca3c9f79456ff41ee523caad45356560' 
  AND (
    token = 'LaGIfDbxRDuxInEJlo59Cxs0xwk2a4CjUdk5aeMk9QI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030