UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U0Gc1nq3eVtCrGEo83GGLwWVjZiNdpUc3Wm/ZRVvRTg=' 
WHERE 
  key_id = '80384ab544edccda5ece369259ce68031a1ecc0e23102e278cacd7ce37d4e719' 
  AND (
    token = 'U0Gc1nq3eVtCrGEo83GGLwWVjZiNdpUc3Wm/ZRVvRTg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031