UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BWG9vAmv3DIhRlg2uXGZSMIoKb/IQFDBHfkUYvpjXmQ=' 
WHERE 
  key_id = '86a7159de1861e3ffc68b99528edb1ad5648858a916edd11ba40ee24bdd3dc51' 
  AND (
    token = 'BWG9vAmv3DIhRlg2uXGZSMIoKb/IQFDBHfkUYvpjXmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026