UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b6I/8EU2r5KVKEkW/FMT0zbEcy682duAueLD3G1NT6U=' 
WHERE 
  key_id = 'c0b84999d0807648c2565c44e501efd8305926815670f6ea22983f439d8db517' 
  AND (
    token = 'b6I/8EU2r5KVKEkW/FMT0zbEcy682duAueLD3G1NT6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049