UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zK1JNxbTM8KTYPCds+VScPDcFU2TijMIyn1CrKcYNhs=' 
WHERE 
  key_id = '8a47455e429895a7ff8182268abfe8a1610bce6d5d12ea4b4bd0c46394c47dde' 
  AND (
    token = 'zK1JNxbTM8KTYPCds+VScPDcFU2TijMIyn1CrKcYNhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025