UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tCERlvo0thPs7cX+WqWMPCJMftgoI6G66hpxuSA6iVA=' 
WHERE 
  key_id = '3bc3bb384880619c5df4255d37c02a0271d1685d7610d22f47dd47ea8682017f' 
  AND (
    token = 'tCERlvo0thPs7cX+WqWMPCJMftgoI6G66hpxuSA6iVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051