UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T+1P1PTuVuQ3yygEDSpcomyQoPynX7htN63aXbKWdUA=' 
WHERE 
  key_id = 'fdb40ea9474e73b7b8982f925b936594c732127259175573f08a0ff33f0a90d8' 
  AND (
    token = 'T+1P1PTuVuQ3yygEDSpcomyQoPynX7htN63aXbKWdUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022