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

Query time 0.00037